grammar Hobbes2008;

options {
	language = Java;
	output=AST;
}

@header {
package edu.calvin.djs32.cs214.interpreters.frontend;
}

@lexer::header {
package edu.calvin.djs32.cs214.interpreters.frontend;

}
@members { 
  protected void mismatch(IntStream input, int ttype, BitSet follow) 
    throws RecognitionException { 
    throw new MismatchedTokenException(ttype, input); 
  } 
  public void recoverFromMismatchedSet(IntStream input, RecognitionException e, BitSet follow) 
    throws RecognitionException { 
    throw e; 
  } 
} 
@rulecatch { 
  catch (RecognitionException e) { 
    throw e; 
  } 
} 
@lexer::members { 
  protected void mismatch(IntStream input, int ttype, BitSet follow) 
    throws RecognitionException { 
    throw new MismatchedTokenException(ttype, input); 
  } 
  public void recoverFromMismatchedSet(IntStream input, RecognitionException e, BitSet follow) 
    throws RecognitionException { 
    throw e; 
  } 
  public void recover(RecognitionException re) {
    throw new RuntimeException(re);
  }
}

program: ((INTEGER)|(STRING)) EOF! ;

fragment
NUMBER : '0'..'9';
fragment
HEXDIGIT:(NUMBER)|(('a'..'f')|('A'..'F'));
fragment

SIGN	:	('+'|'-');	

INTEGER 	:	((SIGN)? (NUMBER)+)|((SIGN)? '0x'(HEXDIGIT)(HEXDIGIT)(HEXDIGIT)(HEXDIGIT));

WHITESPACE
                : (' '|'\t'|'\n'|'\r')
                { skip(); }
                ;
                
COMMENTS
                : ((('/*').*('*/'))|(('//').*('\n'))) 
                { skip(); }
                ;
                
STRING 	:	('\'')~('\'')*('\'');
                


